/*
 * @Description: 你的代码我的心
 * @Author: GGB
 * @Date: 2022-01-25 10:40:18
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-25 14:45:38
 */
import { ApiListGetResultModel, ApiParams, DeleteApiParams } from './model/apiModel';
import { defHttp } from '/@/utils/http/axios';

import { BasicPageParams, BasicResult } from '../model/baseModel';

enum Api {
  ApiList = '/store.api/index',
  AddApi = '/store.api/add',
  EditApi = '/store.api/edit',
  DeleteApi = '/store.api/delete',
}
/**
 * 获取API权限列表
 */
export const getApiList = (params: BasicPageParams) =>
  defHttp.get<ApiListGetResultModel>({ url: Api.ApiList, params });

/**
 * 新增API权限
 */
export const addApi = (params: ApiParams) => defHttp.post<BasicResult>({ url: Api.AddApi, params });

/**
 * 编辑API权限
 */
export const editApi = (params: ApiParams) =>
  defHttp.post<BasicResult>({ url: Api.EditApi, params });

/**
 * 删除API权限
 */
export const deleteApi = (params: DeleteApiParams) =>
  defHttp.post<BasicResult>({ url: Api.DeleteApi, params });
